package com.zzyl.redis;

import com.zzyl.web.user;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.connection.DataType;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.SetOperations;
import org.springframework.data.redis.core.ValueOperations;

import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;

@SpringBootTest
public class RedisTest2 {
    @Autowired
    private RedisTemplate redisTemplate;

    @Test
    public void test() {

        System.out.println(redisTemplate);
    }

    @Test
    public void testString() {
        redisTemplate.opsForValue().set("stringkey", "stringvalue");
        System.out.println(redisTemplate.opsForValue().get("stringkey"));
    }

    @Test
    public void test1() {
        redisTemplate.opsForValue().set("user-001",  new user("张三", 18));
    }


}
